package icasue.tools.sqlhelper.test.mapping.marker;

import icasue.reflect.annotations.NotNull;
import icasue.tools.sqlhelper.core.StandardSqlProvider;

import java.lang.reflect.Field;

/**
 * @Author: Qiao Hang
 * @CreateDate: 2021/9/27 下午4:40
 * @UpdateDate:
 * @Description:
 */
public class UserSqlProvider extends StandardSqlProvider<User, ColMapping> {
    @Override
    public String database() {
        return "`test_database`";
    }

    @Override
    public String table() {
        return "`tb_user`";
    }

    @Override
    protected boolean recursionDiscoveryFields() {
        return true;
    }

    @Override
    protected String mappingOnMarkAnnotation(@NotNull Field jField, @NotNull ColMapping markAnnotation) {
        return markAnnotation.column();
    }


    @Override
    protected String mappingOnLackMarkAnnotation(Field jField, String fName, Class fJavaType, Class nativeTo) {
        // using default column mapping strategy.
        return super.mappingOnLackMarkAnnotation(jField, fName, fJavaType, nativeTo);
    }
}
